/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package tracksuite.presentation;

import java.sql.Timestamp;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import tracksuite.bussiness.HistoryUserBO;
import tracksuite.exception.DAOException;
import tracksuite.exception.GenericException;
import tracksuite.integration.historyuser.HistoryUserTO;

/**
 *
 * @author mfloriano
 */
public class HistoryUserBean extends GenericBean<HistoryUserBO> {

    private String title;
    private String description;

    public HistoryUserBean() {
        this.bo = new HistoryUserBO();
    }
    
    @Override
    public String actionInsert() {
        try {
            HistoryUserTO historyUserTO = new HistoryUserTO();
            historyUserTO.setTitle(getTitle());
            historyUserTO.setDescription(getDescription());
            historyUserTO.setDateInsert(new Timestamp(System.currentTimeMillis()));
            historyUserTO.setDateUpdate(new Timestamp(System.currentTimeMillis()));
            this.bo.insert(historyUserTO);
            return "OK";
        } catch (GenericException ex) {
            Logger.getLogger(CategoryBean.class.getName()).log(Level.SEVERE, null, ex);
            return "ERROR";
        }
    }

    @Override
    public String actionDelete() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public String actionUpdate() {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    
    @Override
    public List getAll() {
        try {
            return this.bo.getAll();
        } catch (DAOException ex) {
            Logger.getLogger(HistoryUserBean.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }



}
